Hacker News new | past | comments | ask | show | jobs | submit login
A Declarative Clock in Eve (incidentalcomplexity.com)
5 points by dahjelle on July 22, 2016 | hide | past | favorite | 2 comments



I tried the example: draw a clock hand // Select all the clock hands hand = [#clock-hand angle length] // Eve will maintain the following objects maintain // Calculate x1, y2, x2, y2 for each hand hand := [#line, x1: 50, y1: 50,

            // using angle and length
            x2: 50 + (length * sin(angle)),
            y2: 50 - (length * cos(angle))]
draw a clock // Select the current time [#time hours minutes seconds] // Update the SVG as the time changes maintain // Add an SVG element to the root of the DOM [#svg viewBox: "0 0 100 100", width: "300px", children:

     // Add a clock face at (50,50) with radius 45.           
     [#circle cx: 50, cy: 50, r: 45, fill: "#0B79CE"]  
           
     // Add the hours hand    
     [#clock-hand angle: 30 * hours, length: 30, stroke: "#023963"]

     // Add the minutes hand   
     [#clock-hand angle: 6 * minutes, length: 40, stroke: "#023963"]

     // Add the seconds hand  
     [#clock-hand angle: 6 * seconds, length: 40, stroke: "#ce0b46"]]

But I get the error:

Invalid function argument (passed string) Only expressions can be arguments to functions

14| x2: 50 + (length * sin(angle)),


Ok, so I just went through the examples and RFC... Eve is ###%%%!! amazing is all I can say!!! :)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: