Fork me on GitHub
Sketch
.
Download
API
Tutorial
You still need a modern browser...............
point yellow = {1,1,0}; point orange = {1,0.75,0}; point white = {1,1,1}; point vec1to2 = {-width*1/4, height/2}; point vec1to3 = {width*1/4, height/2}; polygon t1 = ({width*1/4,height/2}+{width*3/4,height/2})+{width/2,0}; polygon t2 = {width/2,0} + {width*3/4,height/2} + {width*3/4 - 43.3, height/2 -25} + {width/2,50}; polygon t3 = {width/2,50} + {width*3/4 - 43.3, height/2 -25} + {width/4 + 46.3,height/2-25}; function init()->void{ } function sub_osc(num t, num p)->num{ return 4*((t%(p/2))/p); } function oscillator(num time, num period)->num{ num mode = (2*time/period)%2; num sub = sub_osc(time, period); num out; if(mode ?< 1){ return -1 + sub; } else{ return 1 - sub; } return out; } function draw_shadow(){ polygon tcopy = t1; point shadowvec = {20, -15}; point shadowcolour = {47/255, 30/255, 46/255}; tcopy = (tcopy ~ shadowcolour) -> shadowvec; draw tcopy; draw tcopy -> vec1to2; draw tcopy -> vec1to3; } function colour_triangles(point light, point mid, point dark)->void{ t1 = t1 ~ dark; t2 = t2 ~ light; t3 = t3 ~ mid; } function draw_triforce(point shift, point hover)->void{ draw (t1 -> shift) -> hover; draw (t2 -> shift) -> hover; draw (t3 -> shift) -> hover; } function render(num time)->void{ clear; draw_shadow(); num k = 0.5+(oscillator(time, 7000)+1)/2; num l = ((oscillator(time, 7000)+1)/4); point white = {1,1,k}; point yellow = {1,1,l/2}; point orange = {1, 0.75, l/4} point hover = {0, oscillator(time+3500,7000)*10}; colour_triangles(white, yellow, orange); draw_triforce({0,0}, hover); draw_triforce(vec1to2, hover); draw_triforce(vec1to3, hover); }
Render