zoukankan      html  css  js  c++  java
  • flare3d_animation

     过程:添加动作标签。model通过调用动作标签来加载相应的动作。一般的各个动作标签用常量来表明。

    package com.lz.demo {
    import flare.basic.Scene3D;
    import flare.basic.Viewer3D;
    import flare.core.Label3D;
    import flare.core.Pivot3D;
    import flare.system.* //Input3D

    import flash.display.*;
    import flash.events.Event;

    public class demo_anim extends Sprite {
    private var scene:Scene3D;
    private var model:Pivot3D;

    private var walk:Label3D;
    private var run:Label3D;

    public static const WALK:String="walk";
    public static const RUN:String="run";


    public function demo_anim() {

    stage.scaleMode=StageScaleMode.NO_SCALE;
    stage.align=StageAlign.TOP_LEFT;
    scene=new Viewer3D(this);

    walk=new Label3D(WALK, 0, 41);
    run=new Label3D(RUN, 50, 74);

    scene.addEventListener(Scene3D.COMPLETE_EVENT, completeEvent);
    model=scene.addChildFromFile("../resources/player.f3d");
    }

    protected function completeEvent(event:Event):void {

    model.addLabel(walk);
    model.addLabel(run);
    model.gotoAndPlay(WALK);

    scene.addEventListener(Scene3D.UPDATE_EVENT, updateEvent);
    }

    protected function updateEvent(event:Event):void {
    // stop the model animation.
    if ( Input3D.keyHit( Input3D.S ) ) model.stop();
    // resume the model animation.
    if ( Input3D.keyHit( Input3D.P ) ) model.play();

    // play certain animation label and blend between the animations.
    if ( Input3D.keyHit( Input3D.NUMBER_1 ) ) model.gotoAndPlay( WALK, 15 );
    if ( Input3D.keyHit( Input3D.NUMBER_2 ) ) model.gotoAndPlay( RUN, 15 );
    if ( Input3D.keyHit( Input3D.NUMBER_3 ) ) model.gotoAndStop( 0, 10 );

    // increment and decrement frameSpeed.
    if ( Input3D.keyHit( Input3D.NUMPAD_ADD ) ) model.frameSpeed += 0.5;
    if ( Input3D.keyHit( Input3D.NUMPAD_SUBTRACT ) ) model.frameSpeed -= 0.5;

    // reset the frameSpeed.
    if ( Input3D.keyHit( Input3D.R ) ) model.frameSpeed = 1;
    }
    }
    }
  • 相关阅读:
    电子书下载:Pro jQuery
    神鬼传奇小技巧:教你如何修改自己想要的时装
    用虚拟机玩游戏的方法!! 开3D加速!
    如何让DevExpress的DateEdit控件正确显示日期的周名
    SOAP Version 1.2
    Delphi中的容器类
    <神鬼传奇>客户端终极优化精简方法
    今日阅读20090102基本数据结构
    判断一个char[]里是否包含两个连续的\r\n
    蛙蛙推荐:改进同步等待的网络服务端应用
  • 原文地址:https://www.cnblogs.com/xiaowai/p/2348776.html
Copyright © 2011-2022 走看看