• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AnimationStateData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.esotericsoftware.spine.AnimationStateData的典型用法代码示例。如果您正苦于以下问题:Java AnimationStateData类的具体用法?Java AnimationStateData怎么用?Java AnimationStateData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AnimationStateData类属于com.esotericsoftware.spine包,在下文中一共展示了AnimationStateData类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setupTransitions

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
private void setupTransitions(Entity entity) {
	AnimationControlComponent animControl = Mappers.animControl.get(entity);
	SpineComponent spine = Mappers.spine.get(entity);
	AnimationStateData data = spine.state.getData();
	
	data.setDefaultMix(animControl.data.defaultTransition());
	
	Array<Animation> animations = data.getSkeletonData().getAnimations();
	for (int i = 0; i < animations.size; ++i) {
		for (int j = 0; j < animations.size; ++j) {
			if (i == j) { continue; }
			
			Animation from = animations.get(i);
			Animation to = animations.get(j);
			
			if (animControl.data.hasTransition(from, to)) {
				float duration = animControl.data.transition(from, to);
				data.setMix(from, to, duration);
			}
		}
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:23,代码来源:AnimationControlSystem.java


示例2: retrieveSource

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
private void retrieveSource(String source, String atlas) {
	EngineLogger.debug("Retrieving: " + source);
	SkeletonCacheEntry entry = (SkeletonCacheEntry) sourceCache.get(source);

	if (entry == null || entry.refCounter < 1) {
		loadSource(source, atlas);
		EngineAssetManager.getInstance().finishLoading();
		entry = (SkeletonCacheEntry) sourceCache.get(source);
	}

	if (entry.skeleton == null) {
		SkeletonData skeletonData = EngineAssetManager.getInstance().get(getFileName(source), SkeletonData.class);

		entry.skeleton = new Skeleton(skeletonData);

		AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines
																				// mixing
																				// between
																				// animations.
		stateData.setDefaultMix(0f);

		entry.animation = new AnimationState(stateData);
		entry.animation.addListener(animationListener);
	}
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:26,代码来源:SpineRenderer.java


示例3: SkeletonActorPool

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
public SkeletonActorPool (SkeletonRenderer renderer, SkeletonData skeletonData, AnimationStateData stateData,
	int initialCapacity, int max) {
	super(initialCapacity, max);

	this.renderer = renderer;
	this.skeletonData = skeletonData;
	this.stateData = stateData;

	obtained = new Array(false, initialCapacity);

	skeletonPool = new Pool<Skeleton>(initialCapacity, max) {
		protected Skeleton newObject () {
			return new Skeleton(SkeletonActorPool.this.skeletonData);
		}

		protected void reset (Skeleton skeleton) {
			skeleton.setColor(Color.WHITE);
			skeleton.setFlip(false, false);
			skeleton.setSkin((Skin)null);
			skeleton.setSkin(SkeletonActorPool.this.skeletonData.getDefaultSkin());
			skeleton.setToSetupPose();
		}
	};

	statePool = new Pool<AnimationState>(initialCapacity, max) {
		protected AnimationState newObject () {
			return new AnimationState(SkeletonActorPool.this.stateData);
		}

		protected void reset (AnimationState state) {
			state.clearTracks();
			state.clearListeners();
		}
	};
}
 
开发者ID:laurencegw,项目名称:jenjin,代码行数:36,代码来源:SkeletonActorPool.java


示例4: load

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
@Override
public void load(OverlapScene scene, Entity entity, ObjectMap<String, String> map) {
	CCTvComponent cctv = new CCTvComponent();
	SizeComponent size = new SizeComponent();
	SpineComponent spine = new SpineComponent();
	AnimationControlComponent control = new AnimationControlComponent();
	ObserverComponent observer = new ObserverComponent();
	
	AssetManager assetManager = Env.getGame().getAssetManager();
	
	// Load cctv properties
	cctv.angularVelocity = Float.parseFloat(map.get("angularVelocity", "0.0"));
	cctv.maxAngle = Float.parseFloat(map.get("maxAngle", "0.0"));
	cctv.minAngle = Float.parseFloat(map.get("minAngle", "0.0"));
	cctv.waitTimeMaxAngle = Float.parseFloat(map.get("waitTimeMaxAngle", "0.0"));
	cctv.waitTimeMinAngle = Float.parseFloat(map.get("waitTimeMinAngle", "0.0"));
	
	// Load spine animation
	SkeletonData skeletonData = assetManager.get("spine/Beholder.json", SkeletonData.class);
	spine.skeleton = new Skeleton(skeletonData);
	AnimationStateData stateData = new AnimationStateData(skeletonData);
	spine.state = new AnimationState(stateData);
	
	size.width = 0.5f;
	size.height = 0.5f;
	
	control.data = assetManager.get("anims/cctv.json", AnimationControl.class);
	
	observer.fovAngle = 20.0f;
	observer.distance = 4.5f;
	
	entity.add(size);
	entity.add(spine);
	entity.add(cctv);
	entity.add(control);
	entity.add(observer);
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:38,代码来源:CCTvPlugin.java


示例5: load

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
@Override
public void load(OverlapScene scene, Entity entity, ObjectMap<String, String> value) {
	PhysicsComponent physics = new PhysicsComponent();
	PlayerComponent player = new PlayerComponent();
	SpineComponent spine = new SpineComponent();
	SizeComponent size = new SizeComponent();
	AnimationControlComponent animControl = new AnimationControlComponent();
	ObservableComponent observable = new ObservableComponent();
	
	AssetManager assetManager = Env.getGame().getAssetManager();
	
	SkeletonData skeletonData = assetManager.get("spine/Player.json", SkeletonData.class);
	spine.skeleton = new Skeleton(skeletonData);
	AnimationStateData stateData = new AnimationStateData(skeletonData);
	spine.state = new AnimationState(stateData);
	
	animControl.data = assetManager.get("anims/player.json", AnimationControl.class);
	
	size.width = 0.5f;
	size.height = 1.4f;
	
	entity.add(physics);
	entity.add(player);
	entity.add(spine);
	entity.add(size);
	entity.add(animControl);
	entity.add(observable);
	
	cameraSystem.setTarget(entity);
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:31,代码来源:PlayerPlugin.java


示例6: read

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
@Override
public Component read(JsonValue value) {
	SpineComponent component = new SpineComponent();
	component.state = new AnimationState(Env.game.getAssets().get(value.getString("name"), AnimationStateData.class));
	component.skeleton = new Skeleton(component.state.getData().getSkeletonData());
	return component;
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:8,代码来源:ComponentReaders.java


示例7: loadAsync

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file, AnimationStateDataLoaderParameter parameter) {
	logger.info("loading " + fileName);
	
	data = new AnimationStateData(manager.get(parameter.skeletonName, SkeletonData.class));
	
	try {
		JsonReader reader = new JsonReader();
		JsonValue root = reader.parse(file);
		
		float defaultBlend = root.get("defaultBlend").asFloat();
		
		logger.info("default blend: " + defaultBlend + "s");
		
		data.setDefaultMix(defaultBlend);
		
		JsonIterator blendIt = root.get("blends").iterator();
		
		while (blendIt.hasNext()) {
			JsonValue blendValue = blendIt.next();
			String from = blendValue.get("from").asString(); 
			String to = blendValue.get("to").asString();
			float duration = blendValue.get("duration").asFloat();
			
			data.setMix(from, to , duration);
			
			logger.info("blend: " + from + " -> " + to + " [" + duration + "s]");
		}
	}
	catch (Exception e) {
		logger.error("error loading " + fileName + " " + e.getMessage());
	}
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:34,代码来源:AnimationStateDataLoader.java


示例8: Assets

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
public Assets(String assetFile) {
		logger = new Logger(TAG, Env.debugLevel);
		
		logger.info("initialising");
		
		manager = new AssetManager();
//		manager.setErrorListener(this);
		manager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
		manager.setLoader(PhysicsData.class, new PhysicsLoader(new InternalFileHandleResolver()));
		manager.setLoader(SpriteAnimationData.class, new SpriteAnimationLoader(new InternalFileHandleResolver()));
		manager.setLoader(SkeletonData.class, new SkeletonDataLoader(new InternalFileHandleResolver()));
		manager.setLoader(AnimationStateData.class, new AnimationStateDataLoader(new InternalFileHandleResolver()));
		
		loadGroups(assetFile);
	}
 
开发者ID:saltares,项目名称:sioncore,代码行数:16,代码来源:Assets.java


示例9: init

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
private void init (SkeletonData skeletonData) {
	skeleton = new Skeleton(skeletonData);

	stateData = new AnimationStateData(skeletonData);
	state = new AnimationState(stateData);

	defaultAnimation = skeleton.getData().getAnimations().get(0).getName();
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:9,代码来源:VisSpine.java


示例10: setSkeleton

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
public void setSkeleton(SkeletonData skeletonData) {
	this.skeleton = new Skeleton(skeletonData);
	AnimationStateData stateData = new AnimationStateData(skeletonData);
	state = new AnimationState(stateData);
	setVisible(true);
	bounds = new SkeletonBounds();
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:8,代码来源:SpineActor.java


示例11: getAnimationStateData

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
public AnimationStateData getAnimationStateData() {
	return _animationStateData;
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:4,代码来源:EntityInformation.java


示例12: setAnimationStateData

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
protected void setAnimationStateData(AnimationStateData animationStateData) {
	_animationStateData = animationStateData;
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:4,代码来源:EntityInformation.java


示例13: loadSpineAnimation

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
private Entity loadSpineAnimation(JsonValue value)
{
	Entity entity = new Entity();
	
	logger.info("loading spine anim: " + value.getString("animationName"));
	
	NodeComponent node = new NodeComponent();
	TransformComponent transform = new TransformComponent();
	ZIndexComponent index = new ZIndexComponent();
	SizeComponent size = new SizeComponent();
	SpineComponent spine = new SpineComponent();
	IDComponent id = new IDComponent();
	
	id.value = value.getInt("uniqueId");
	
	loadTransform(transform, value);
	index.layer = value.getString("layerName");
	
	// Load custom info
	ObjectMap<String, String> extraInfo = 
			getExtraInfo(value.has("customVars") ? value.getString("customVars") : null);

	// Get animation asset path
	String animationName = value.getString("animationName");
	String animationPathWithoutExtension = 
			parameters.spineFolder + animationName + "/" + animationName;
	
	// Load spine atlas
	SkeletonData skeletonData = Env.getGame().getAssetManager().get(
			animationPathWithoutExtension + ".json", 
			SkeletonData.class);
	
	// Load spine skeleton
	spine.skeleton = new Skeleton(skeletonData);
	
	// Load animation state data
	AnimationStateData stateData = new AnimationStateData(skeletonData);
	spine.state = new AnimationState(stateData);
	spine.skeleton.setSkin(skeletonData.getSkins().first());
	spine.state.setAnimation(
		0, 
		value.getString("currentAnimationName"), 
		true
	);

	// Update bounds and origin
	spine.skeleton.updateWorldTransform();
	spine.skeleton.getBounds(v2Utils1, v2Utils2);
	size.width = v2Utils2.x;
	size.height = v2Utils2.y;
	transform.origin.set(v2Utils1);
	// Fix to position spine anim in the right coords... TODO: Is there a good solution?
	transform.position.add(size.width * .5f, size.height * .8f);

	entity.add(node);
	entity.add(size);
	entity.add(transform);
	entity.add(index);
	entity.add(spine);
	entity.add(id);
	
	return entity;
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:64,代码来源:OverlapSceneLoader.java


示例14: loadSync

import com.esotericsoftware.spine.AnimationStateData; //导入依赖的package包/类
@Override
public AnimationStateData loadSync(AssetManager manager, String fileName, FileHandle file, AnimationStateDataLoaderParameter parameter) {
	return data;
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:5,代码来源:AnimationStateDataLoader.java



注:本文中的com.esotericsoftware.spine.AnimationStateData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SchemaNamespaceSupport类代码示例发布时间:2022-05-23
下一篇:
Java CommandStop类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap