<s> from pyjamas . Canvas . GWTCanvas import GWTCanvas <EOL> from pyjamas . ui . RootPanel import RootPanel <EOL> from pyjamas . DOM import getFirstChild <EOL> from pyjamas import Window <EOL> from pyjamas . ui . HTML import HTML <EOL> import math <EOL> from __pyjamas__ import jsinclude <EOL> jsinclude ( "<STR_LIT>" ) <EOL> from __javascript__ import Processing <EOL> p = None <EOL> radius = <NUM_LIT> <EOL> delay = <NUM_LIT:16> <EOL> def setup ( ) : <EOL> global p , radius , delay , X , Y , nX , nY <EOL> p . size ( <NUM_LIT:200> , <NUM_LIT:200> ) <EOL> p . strokeWeight ( <NUM_LIT:10> ) <EOL> p . frameRate ( <NUM_LIT:15> ) <EOL> X = p . width / <NUM_LIT:2> <EOL> Y = p . width / <NUM_LIT:2> <EOL> nX = X <EOL> nY = Y <EOL> def draw ( ) : <EOL> global p , radius , delay , X , Y , nX , nY <EOL> radius = radius + math . sin ( p . frameCount / <NUM_LIT:4> ) <EOL> X += ( nX - X ) / delay <EOL> Y += ( nY - Y ) / delay <EOL> p . background ( <NUM_LIT:100> ) <EOL> p . fill ( <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> ) <EOL> p . stroke ( <NUM_LIT:255> ) <EOL> p . ellipse ( X , Y , radius , radius ) <EOL> def mouseMoved ( ) : <EOL> global p , nX , nY <EOL> nX = p . mouseX <EOL> nY = p . mouseY <EOL> class ProcessingCanvas ( GWTCanvas ) : <EOL> def __init__ ( self ) : <EOL> GWTCanvas . __init__ ( self , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> self . c = getFirstChild ( self . getElement ( ) ) <EOL> self . p = Processing ( self . c ) <EOL> global p <EOL> p = self . p <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> note = HTML ( """<STR_LIT>""" ) <EOL> RootPanel ( ) . add ( note ) <EOL> PC = ProcessingCanvas ( ) <EOL> PC . p . setup = setup <EOL> PC . p . draw = draw <EOL> PC . p . mouseMoved = mouseMoved <EOL> PC . p . init ( ) <EOL> RootPanel ( ) . add ( PC ) </s>
