我有一个关于2D Sprite动画的快速问题,我无法在任何地方找到具体答案:
我有一个带有步行动画的精灵到右边.但是,当他向左走(2D侧卷轴)时,我显然想将动画向左翻转.
我可以轻松地翻转精灵本身transform.localscale.x,然而,使用只翻转精灵.不是动画片段.(这不再发生在Unity中)
因此,当精灵翻转时,动画片段开始播放的那一刻,它会向右翻转(因为我唯一的动画片段是面向右侧的精灵).
这是在Photoshop中翻转精灵的唯一方法,还是有办法在Unity中执行此操作?
谢谢!
更新:如果通过乘以它来缩放变换,则使用单位的实际版本-1,动画帧也会缩放.
我正在尝试在同一元素的实例之间同步我的一些Web组件属性,因此如果其中一个属性发生更改,则相同的属性将在具有相应绑定和事件的所有实例中更新.
注意:我想将Polymer Data System Concepts用于实例之间的通信.
我-element.html
<dom-module id="my-element">
<script>
Polymer({
is: 'my-element',
properties: {
myProp: {
type: String,
notify: true
}
});
</script>
</dom-module>
Run Code Online (Sandbox Code Playgroud)
我 - 其他 - element.html
<dom-module id="my-other-element">
<template>
<my-element my-prop="{{otherProp}}"></my-element>
</template>
<script>
Polymer({
is: 'my-other-element',
properties: {
otherProp: {
type: String,
notify: true,
readOnly: true
}
}
})
</script>
</dom-module>
Run Code Online (Sandbox Code Playgroud)
我-app.html
<dom-module id="my-app">
<template>
<my-element id="element"></my-element>
<my-other-element id="otherElement"
on-other-prop-changed="onPropChanged"
></my-other-element>
</template>
<script>
Polymer({
is: 'my-app',
attached: function () {
// should set …Run Code Online (Sandbox Code Playgroud) 我想将具有枚举类型的一个对象的属性映射到具有其他枚举类型的另一个对象的属性。
我尝试过type1.a as Enum2或Enum2[type1.a]没有成功。
这是我的简化代码问题:
enum Enum1 {
N = 0,
A = 1,
B = 2
}
enum Enum2 {
A = 1,
B = 2
}
interface Type1 {
a: Enum1;
}
interface Type2 {
a: Enum2;
}
const type1: Type1 = {
a: Enum1.A
};
const type2: Type2 = {
a: type1.a
};
Run Code Online (Sandbox Code Playgroud)
抛出错误:
Type 'Enum1' is not assignable to type 'Enum2'.
(property) Type2.a: Enum2
Run Code Online (Sandbox Code Playgroud) 我试图找出一种方法,使“每次观看的”文件发生更改时,polyserve / polymer-cli都可以重新加载浏览器,但是除了将Livereload添加到我认为将要添加到HTMLs文件中之外,我没有发现任何其他方法由于开发Web组件时我会加载单独的HTML文件,因此一团糟。
polymer ×2
2d ×1
animation ×1
c# ×1
casting ×1
enums ×1
polymer-1.0 ×1
polymer-2.x ×1
polymer-cli ×1
reload ×1
serve ×1
sprite ×1
typescript ×1
watch ×1