1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #include "HelloWorldScene.h" Scene* HelloWorld::createScene() { auto scene = Scene::create(); auto layer = HelloWorld::create(); scene->addChild(layer); return scene; } bool HelloWorld::init() { if (!Layer::init()) { return false; } auto spr = Sprite::create("Icon-57.png") ; spr->setPosition(Point(100, 100)); spr->setOpacity(0); this->addChild(spr); auto action = FadeIn::create(3.0); spr->runAction(action); //auto action = FadeOut::create(3.0); //spr->runAction(action); //auto action = FadeTo::create(3.0,128); //spr->runAction(action); return true; } | cs |
fade out 은 서서히 투명해지는 메소드
fade in 은 서서히 드러나는 메소드
fade to 은 특정 투명도로 특정시간동안 유지시켜주는 메소드