You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
t0 = Date.now()
def rotate_property():
""" Helper function mapping user agents to transform proeprty names """
if 'Chrome' in window.navigator.userAgent: return 'webkitTransform'
elif 'Firefox' in window.navigator.userAgent: return 'MozTransform'
elif 'MSIE' in window.navigator.userAgent: return 'msTransform'
elif 'Opera' in window.navigator.userAgent: return 'OTransform'
return 'transform'
degrees = 0
def animation_step(elem_id='img1'):
""" Called every 30msec to increase the rotatation of the element. """
nonlocal degrees
# Get the right property name according to the useragent
prop = rotate_property()
# Get the element by id
el = document.getElementById(elem_id)
# Set the rotation of the element
el.style[prop] = "rotate(" + degrees + "deg)"
document.getElementById('status').innerHTML = "rotate(" + degrees + "deg)"
# Increase the rotation
degrees += 1
if degrees > 360:
# Stops the animation after 360 steps
clearInterval(tm)
degrees = 0
# Start the animation
tm = setInterval(animation_step, 30)
document.getElementById('status3').innerHTML = "Time of execution python code(" + (Date.now() - t0) + " ms)"
I have this code
and this
How to convert it to PyPy.js that Can I use it?
The text was updated successfully, but these errors were encountered: