본문 바로가기
코딩과 알고리즘

웹에 퐁당, 파이스크립트의 빙글빙글 레이어

반응형

파이스크립트 관련 서적을 준비중입니다.
그동안 블로그를 찾아와주시는 분들을 위해 일부를 기록합니다.

본문의 내용은 필자의 파이스크립트 연습장 웹사이트에서 테스트 가능합니다.
http://dreamplan7.cafe24.com/py/

import math
from js import jQuery as jq
layer1 = jq("#layer1")
if layer1.length==0:
  exit("LAYER NEED")
layer1.text("비행기✈")
s = 0
radius = 200
centerx =300
centery =200
while True:
  x = math.sin(math.pi * ( s / 180)) * radius + centerx
  y = math.cos(math.pi * ( s / 180)) * radius + centery
  layer1.css("left", str(x) + "px")
  layer1.css("top", str(y) + "px")
  await asyncio.sleep(0.01)
  s = s - 5
  if s <= -180:
    s = 180

 

오늘도 찾아와주시는 분들께 감사드립니다.
삶의 순간 순간 평온하시길 소망합니다~

반응형