-
-
Save natmark/1b5fd06c7d679e8ccb8d888a73b64f48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Scene1.swift | |
// ipad-pitagora | |
// | |
// Created by AtsuyaSato on 2017/12/12. | |
// Copyright © 2017年 Atsuya Sato. All rights reserved. | |
// | |
import ProcessingKit | |
import simple_tween | |
extension PitagoraView { | |
func setupScene1() { // Tween経由で実行時間の設定と、setup関数とdraw関数のセレクタを準備する | |
sceneInfos[Scene.scene1.rawValue] = (Tween(3), #selector(setup1), #selector(draw1)) | |
} | |
func setup1() { // シーン開始時に1度だけ呼ばれる | |
background(255, 255, 255) | |
} | |
func draw1() { // Tweenの再生が終わるまで、毎フレーム呼ばれる | |
let x = lerp(sceneInfos[Scene.scene1.rawValue].tween.position, min: 0, max: Double(width)) | |
fill(255, 0, 0) | |
ellipse(CGFloat(x), 100, 100, 100) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment