JoshuaDavis icon

nesting and HOscillator

JoshuaDavis | PRO | 01/31/14 03:09:08 PM UTC | 0 ⭐ | 369 👁️ | Never ⏰ | []
Java |

530 B

|

None

|

0 👍

/

0 👎

// r2 nested in r1, HOscillator on r1 ALSO oscillates the nested r2
 
HRect r1, r2;
 
void setup(){
    size(640,640);
    H.init(this).background(#202020);
    smooth();
 
    r1 = new HRect(100).rounding(10);
    H.add(r1)
        .anchorAt(H.CENTER)
        .loc(width/2,height/2)
        .noStroke()
        .fill(#FF3300)
    ;
 
    r2 = new HRect(50).rounding(5);
    r1.add(r2)
        .anchorAt(H.CENTER)
        .noStroke()
        .fill(#0095a8)
    ;
 
    new HOscillator().target(r1).property(H.ROTATION).range(-180, 180).speed(0.5).freq(5);
}
 
void draw(){
    H.drawStage();
}

Comments