简体   繁体   English

如何将动画片段悬停在文本区域上,使其看起来像是文本的一部分?

[英]How can I float a movieclip over a textarea to make it appear like it's part of the text?

Take a look at this demo , how do they accomplish the Inline Changes feature? 看一下这个演示 ,他们如何完成内联更改功能? To me it looks like they are floating a movieclip over the textarea. 对我来说,好像他们是在文本区域上浮动影片剪辑。

What I can't figure out is how they anchored the movieclip to stay in the correct position. 我不知道的是他们如何将动画片段固定在正确的位置。 If you type something before the movieclip it moves position along with the text, the movieclips even move to the next line when the text word wraps. 如果在动画片段之前键入某些内容,它会随文本一起移动位置,则当文本单词换行时,动画片段甚至会移至下一行。 Does anyone have an idea? 有人有主意吗?

What I think they're doing is keeping track of the index the sprite is representing. 我认为他们正在做的是跟踪精灵所代表的索引。 Then they have a nice function that moves the sprite to the correct position given the size of the textbox and font. 然后它们具有一个不错的功能,可以根据文本框和字体的大小将精灵移动到正确的位置。 All you need to do after that is bind the positioning function to changes made to the textbox and you've got that effect. 之后,您需要做的所有工作就是将定位功能绑定到对文本框所做的更改,您将获得效果。 Doesn't seem too complicated, as there are already font size/position functions available. 似乎不太复杂,因为已经有字体大小/位置功能。

EDIT: Notice how you cannot type code in between the overlapping regions. 编辑:请注意您如何不能在重叠区域之间键入代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM