当前位置:   article > 正文

创作一款表情包生成微信小程序:功能详解与用户体验优化_微信表情制作在线生成器

微信表情制作在线生成器

一、引言

        在当今社交媒体充斥着各种趣味表情包的时代,表情包生成工具成为许多用户创作和分享创意的热门选择。为了迎合这一趋势,我设计并开发了一款功能丰富、用户友好的微信小程序,旨在让用户能够轻松而有趣地创作个性化的表情包。这篇博客将深入介绍我的微信小程序,详解其各项功能,以及为了提升用户体验而进行的设计和优化。无论是内置的上百种头像素材,还是支持自定义上传与编辑的功能,我将逐一展示这个小程序的强大之处,帮助读者更好地理解并使用这款创意工具。

二、背景

        在数字创意时代,表情包已经成为人们交流中不可或缺的一部分。然而,尽管微信推出了名为“微信创意表情”的小程序,我却发现它在素材数量和用户自定义方面存在一些限制。素材有限、用户无法自定义上传图片,这些限制让我看到了改进的空间,因此萌发了开发自己的表情包生成微信小程序的念头。

        我的小程序的背景正是在这样的需求和不足之下诞生的。通过深入研究用户反馈和市场调研,我决定打造一款更加强大、灵活且富有创意的表情包生成工具。我的初衷是为用户提供一个自由、个性化的创作空间,让他们能够尽情表达自己的创意,而不受素材和功能的限制。通过模仿并超越现有的小程序,我致力于打破创作的边界,让用户在表情包的世界中享受更多的乐趣和创意。这款小程序不仅仅是一款工具,更是我对创意自由和个性表达的热忱回应。

三、已实现功能

  • 1、内置上百种头像合成素材:

提供丰富多样的素材,包括脸、嘴、眼、身体、手、网络脸、挂架等,供用户选择和合成。

  • 2、可自定义上传图片:

允许用户自由上传个人照片或网络素材,拓展创作空间,让表情包更具个性。

  • 3、图片支持移动、缩放、旋转、批量选择:

提供直观的操作界面,用户可以自由调整图片的位置、大小、旋转角度,并支持批量选择多个元素进行统一操作。

  • 4、图层可以通过列表拖拽实现上下排序:

实现直观的图层管理,用户可通过简单的拖拽操作调整图层的顺序,灵活掌握表情包的层次结构。

  • 5、不同颜色、触点大小的涂鸦:

提供丰富的涂鸦工具,用户可以自由选择不同颜色和触点大小,为表情包添加更多创意元素。

  • 6、文字输入:

实现文字输入功能,用户可选择不同颜色的文字,自由添加文字表达情感或创意。

  • 7、图层自由调整透明度:

用户可以对每个图层进行透明度调整,实现更丰富的叠加效果。

  • 8、图层左右镜像:

提供左右镜像功能,增加表情包的变化和趣味性。

  • 9、图层复制:

允许用户复制已有的图层,方便创作时的重复元素使用。

  • 10、将合成的图片导出:

提供简便的导出功能,让用户能够保存和分享自己创作的表情包。

四、素材库设计

我定义了一个组件”EmojiCardPanel“,从网上搜罗了许多素材,然后获取到所有素材的宽、高。定义素材相对于图层左上角的坐标值。实现效果。

上层是tab,下层是 swiper+scroll-view

代码如下:

  1. <script setup lang="ts">
  2. import { onMounted, ref } from 'vue'
  3. const emits = defineEmits<{
  4. //选择emoji
  5. (e: 'selectEmoji', x: number, y: number, w: number, h: number, url: string): void
  6. }>()
  7. /** Tab 选项 */
  8. type TabOption = {
  9. id: number
  10. title: string
  11. details: TabDetail[]
  12. }
  13. /** Tab 明细 */
  14. type TabDetail = {
  15. url: string
  16. x: number
  17. y: number
  18. w: number
  19. h: number
  20. }
  21. // 所有tab
  22. const tabs = ref<TabOption[]>([])
  23. // 当前选择Tab Index
  24. const activeTabIndex = ref<number>(-1)
  25. // 选择图片Id
  26. const currentTouchImageId = ref<number>(-1)
  27. onMounted(() => {
  28. tabs.value = [在这里填充tab数据]
  29. activeTabIndex.value = 0
  30. })
  31. // 选择tab
  32. const onSelectTab = (index: number) => {
  33. activeTabIndex.value = index
  34. }
  35. // image touch start
  36. const onImageTouchStart = (img: TabDetail, index: number) => {
  37. currentTouchImageId.value = index
  38. }
  39. // image tap
  40. const onTap = (img: TabDetail, index: number) => {
  41. currentTouchImageId.value = index
  42. uni.downloadFile({
  43. url: img.url,
  44. success: (res) => {
  45. if (res.statusCode === 200) {
  46. emits('selectEmoji', img.x, img.y, img.w, img.h, res.tempFilePath)
  47. currentTouchImageId.value = -1
  48. } else {
  49. uni.showToast({
  50. title: '下载资源失败,状态码:' + res.statusCode,
  51. })
  52. currentTouchImageId.value = -1
  53. }
  54. },
  55. fail: (error) => {
  56. uni.showToast({
  57. title: '资源下载异常',
  58. })
  59. currentTouchImageId.value = -1
  60. },
  61. })
  62. }
  63. // image touch end
  64. const onImageTouchEnd = () => {
  65. currentTouchImageId.value = -1
  66. }
  67. </script>
  68. <template>
  69. <view class="emoji-card-panel">
  70. <view class="tabs">
  71. <text
  72. class="text"
  73. :class="{ select: index === activeTabIndex }"
  74. v-for="(tab, index) in tabs"
  75. :key="'tab_' + index"
  76. @tap="onSelectTab(index)"
  77. >{{ tab.title }}</text
  78. >
  79. </view>
  80. <swiper
  81. class="swiper"
  82. :current="activeTabIndex"
  83. @change="activeTabIndex = $event.detail.current"
  84. >
  85. <swiper-item v-for="(tab, index) in tabs" :key="'detail_' + index">
  86. <scroll-view class="tab-detail" scroll-y>
  87. <view class="images">
  88. <image
  89. class="image"
  90. :lazy-load="true"
  91. mode="widthFix"
  92. :class="{ touch: ix === currentTouchImageId }"
  93. @tap="onTap(img, ix)"
  94. @touchstart="onImageTouchStart(img, ix)"
  95. @touchend="onImageTouchEnd"
  96. v-for="(img, ix) in tab.details"
  97. :key="'img_' + ix"
  98. :src="img.url"
  99. ></image>
  100. </view>
  101. </scroll-view>
  102. </swiper-item>
  103. </swiper>
  104. </view>
  105. </template>
  106. <style lang="scss" scoped>
  107. .emoji-card-panel {
  108. height: 100%;
  109. width: 100%;
  110. display: flex;
  111. flex-direction: column;
  112. padding-top: 5px;
  113. font-size: 13px;
  114. .tabs {
  115. display: flex;
  116. justify-content: space-between;
  117. align-items: center;
  118. height: 40rpx;
  119. margin: 10px;
  120. .text {
  121. padding: 3px 10px;
  122. border-radius: 15px;
  123. &.select {
  124. background-color: #07c160;
  125. color: white;
  126. /* 过渡效果 */
  127. transition: all 0.4s;
  128. }
  129. }
  130. }
  131. .tab-detail {
  132. flex: 1;
  133. .images {
  134. display: flex;
  135. flex-wrap: wrap;
  136. justify-content: space-between;
  137. padding: 0 10rpx 10rpx;
  138. .image {
  139. width: 40px;
  140. padding: 10px;
  141. border-radius: 12px;
  142. margin: 5px;
  143. &.touch {
  144. background-color: rgba(0, 0, 0, 0.1);
  145. }
  146. }
  147. .image:last-child {
  148. margin-right: auto;
  149. }
  150. }
  151. }
  152. }
  153. </style>

五、自定义上传与编辑

这个就不用说了,选择图片,上传,然后图片绘制到最上层图层,并默认选中

六、图层管理

针对图层管理,是最复杂的,同样也增加了一个组件”CanvasDragPanel“,没有使用 2d版本的canvas ,虽然2d渲染速度更快,但是发现图层在移动、缩放时有闪烁,不管是用双缓冲还是requestAnimationFrame 都未能解决这个闪烁问题。因为要涂鸦,所以用了两个canvas,在涂鸦时将主canvas隐藏,涂鸦结束后,再调换过来。

这里的难点是,图层选择、移动、缩放、删除、并且我还设计了批量选择,这些都将是此小程序实现的难点。

  1. <template>
  2. <view
  3. class="canvas-drag-panel"
  4. :style="{
  5. width: props.width + 'px',
  6. height: props.height + 'px',
  7. }"
  8. >
  9. <!--主canvas-->
  10. <canvas
  11. id="mainCanvasId"
  12. canvas-id="mainCanvasId"
  13. :class="{
  14. disabled: mainCanvasDisabled,
  15. }"
  16. class="canvas main-canvas"
  17. @touchstart="touchStart"
  18. @touchmove="touchMove"
  19. @touchend="touchEnd"
  20. @error="touchError"
  21. @touchcancel="touchCancel"
  22. :disable-scroll="true"
  23. ></canvas>
  24. <!--涂鸦canvas、将文本转换图片canvas-->
  25. <canvas
  26. v-show="graffitiCanvasShow"
  27. canvas-id="graffitiCanvasId"
  28. @touchstart="graffitiTouchStart"
  29. @touchmove="graffitiTouchMove"
  30. @touchend="graffitiTouchEnd"
  31. :disable-scroll="true"
  32. class="canvas graffiti-canvas"
  33. ></canvas>
  34. </view>
  35. </template>

七、涂鸦和文字输入

涂鸦和文字输入也是封装了两个组件分别是”GraffitiPanel“和”AddTextPanel“,至于选择涂鸦还是文字,因为是一个按钮组和后面的调节是一样的,封装了一个组件”ButtonGroupPanel

涂鸦面板效果:

代码如下:

  1. <script setup lang="ts">
  2. import { ref } from 'vue'
  3. const emits = defineEmits<{
  4. // 取消
  5. (e: 'cancelGraffiti'): void
  6. // 完成
  7. (e: 'completeGraffiti'): void
  8. // 选择stroke
  9. (e: 'selectGraffitiStroke', index: number): void
  10. // 选择color
  11. (e: 'selectGraffitiColor', index: number): void
  12. }>()
  13. // 定义组件属性
  14. const props = defineProps<{
  15. top: number
  16. height: number
  17. strokeDataList: number[]
  18. colorDataList: string[]
  19. }>()
  20. // 取消
  21. const cancelGraffiti = () => {
  22. emits('cancelGraffiti')
  23. }
  24. // 完成
  25. const endGraffiti = () => {
  26. emits('completeGraffiti')
  27. }
  28. // 选择 stroke
  29. const selectGraffitiStroke = (index: number) => {
  30. currentGraffitiStrokeIndex.value = index
  31. emits('selectGraffitiStroke', index)
  32. }
  33. // 选择yanse
  34. const selectGraffitiColor = (index: number) => {
  35. emits('selectGraffitiColor', index)
  36. currentGraffitiColorIndex.value = index
  37. }
  38. // 当前选择stroke
  39. const currentGraffitiStrokeIndex = ref<number>(1)
  40. // 当前选择颜色
  41. const currentGraffitiColorIndex = ref<number>(1)
  42. </script>
  43. <template>
  44. <view
  45. class="graffiti-panel"
  46. :style="{
  47. top: props.top + 'px',
  48. height: props.height + 'px',
  49. }"
  50. >
  51. <view class="top">
  52. <text class="left" @tap="cancelGraffiti">取消</text>
  53. <text class="center">涂鸦</text>
  54. <text class="right" @tap="endGraffiti">完成</text>
  55. </view>
  56. <view class="main">
  57. <view class="title"><text>笔触</text></view>
  58. <view class="content">
  59. <view
  60. class="circle-view stroke-view"
  61. :class="{
  62. selected: index === currentGraffitiStrokeIndex,
  63. }"
  64. @tap="selectGraffitiStroke(index)"
  65. v-for="(item, index) in props.strokeDataList"
  66. :key="'stroke_' + index"
  67. >
  68. <view
  69. class="circle"
  70. :style="{
  71. width: item + 'px',
  72. height: item + 'px',
  73. 'background-color': colorDataList[currentGraffitiColorIndex],
  74. }"
  75. ></view>
  76. </view>
  77. </view>
  78. <view class="title"><text>颜色</text></view>
  79. <view class="content">
  80. <view
  81. class="circle-view color-view"
  82. :class="{
  83. selected: index === currentGraffitiColorIndex,
  84. }"
  85. @tap="selectGraffitiColor(index)"
  86. v-for="(item, index) in props.colorDataList"
  87. :key="'color_' + index"
  88. >
  89. <view
  90. class="circle"
  91. :style="{
  92. 'background-color': item,
  93. }"
  94. ></view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <style lang="scss" scoped>
  101. .graffiti-panel {
  102. margin: 0px 5px;
  103. left: 0;
  104. right: 0;
  105. box-shadow: 0px 0px 10px rgba(135, 131, 131, 0.4);
  106. position: absolute;
  107. border-top-right-radius: 10px;
  108. border-top-left-radius: 10px;
  109. background-color: white;
  110. z-index: 998;
  111. .top {
  112. display: flex;
  113. height: 40px;
  114. justify-content: center;
  115. align-items: center;
  116. margin: 5px 10px;
  117. text-align: center;
  118. .left,
  119. .right {
  120. flex: 0 0 50px;
  121. padding: 10px;
  122. }
  123. .center {
  124. flex: 1;
  125. }
  126. }
  127. .main {
  128. margin: 20px;
  129. .title {
  130. height: 40px;
  131. line-height: 40px;
  132. color: darkgrey;
  133. }
  134. .content {
  135. display: flex;
  136. justify-content: center;
  137. align-items: center;
  138. .circle-view {
  139. border-radius: 50%;
  140. margin: 5px;
  141. &.stroke-view {
  142. width: 40px;
  143. height: 40px;
  144. display: flex;
  145. margin: 10px;
  146. align-items: center;
  147. justify-content: center;
  148. background-color: rgba(0, 0, 0, 0.1);
  149. &.selected {
  150. width: 48px;
  151. height: 48px;
  152. margin: 2px;
  153. }
  154. }
  155. &.color-view {
  156. width: 30px;
  157. height: 30px;
  158. margin: 4px;
  159. border: 4px solid rgba(0, 0, 0, 0.1);
  160. &.selected {
  161. width: 34px;
  162. height: 34px;
  163. margin: 2px;
  164. border: 8px solid rgba(0, 0, 0, 0.1);
  165. }
  166. .circle {
  167. height: 100%;
  168. width: 100%;
  169. }
  170. }
  171. .circle {
  172. border-radius: 50%;
  173. }
  174. }
  175. }
  176. }
  177. }
  178. </style>

文字输入效果如下,可以选择子颜色:

八、透明度、翻转、复制

透明度、翻转、复制同样用到了按钮组组件”ButtonGroupPanel“,只是如果未选择图层,三个按钮是置灰状态

因为我用的是非 2d canvas 所以 不支持 ”context.scale(-1, 1)“ ,但是水平翻转这行代码是关键,就用了”createOffscreenCanvas“ ,翻转后将canvas存入临时文件,放入图层列表。

九、图层上下顺序调整、删除

此功能增加了一个单独组件”ListDragPanel“,可以删除图层、按住行尾图标可实现,图层上下顺序调整

代码如下:

  1. <script setup lang="ts">
  2. import { reactive, ref } from 'vue'
  3. const emits = defineEmits<{
  4. //删除拖拽项
  5. (e: 'delDragItem', id: number): void
  6. //选择拖拽项
  7. (e: 'selectDragItem', id: number): void
  8. //拖拽项顺序调整
  9. (e: 'changeDragItemOrder', oneId: number, towId: number): void
  10. }>()
  11. /** 拖拽列表明细类型声明 */
  12. type DragListItem = {
  13. id: number
  14. url: string
  15. }
  16. /** 状态类型声明 */
  17. type StateType = {
  18. // 拖拽列表
  19. dragList: DragListItem[]
  20. // 初始化明细 左上角坐标
  21. initListTop: number[]
  22. // 最新明细 左上角坐标
  23. newListTop: number[]
  24. // 记录当前手指的垂直方向的坐标
  25. touchY: number
  26. // 记录当前操作的item数据
  27. currentItemTop: number
  28. // 当前操作的item的下标
  29. currentItemIndex: number
  30. // 当前选择item id
  31. currentSelectedId: number
  32. // 控制ScrollView 是否可滚动
  33. dragListContainerCanScroll: boolean
  34. }
  35. // 状态控制
  36. const state = reactive<StateType>({
  37. dragList: [],
  38. initListTop: [],
  39. // 坐标数据
  40. newListTop: [],
  41. // 记录当前手指的垂直方向的坐标
  42. touchY: 0,
  43. currentItemTop: 0,
  44. // 当前操作的item的下标
  45. currentItemIndex: -1,
  46. // 当前选择item id
  47. currentSelectedId: -1,
  48. // 控制ScrollView 是否可滚动
  49. dragListContainerCanScroll: true,
  50. })
  51. // 拖拽项 每一项高度
  52. const ITEM_HEIGHT = 55
  53. // 获取所有项 top
  54. const getDragItemTop = (): number[] => {
  55. return state.dragList.map((item, i) => {
  56. return i * ITEM_HEIGHT
  57. })
  58. }
  59. // 触摸开始
  60. const onTouchStart = (event: any, index: number) => {
  61. state.currentSelectedId = state.dragList[index].id
  62. state.dragListContainerCanScroll = false
  63. const [{ pageY }] = event.touches
  64. state.currentItemIndex = index
  65. state.touchY = pageY
  66. state.currentItemTop = state.newListTop[index]
  67. uni.vibrateShort({
  68. type: 'heavy',
  69. })
  70. }
  71. // 触摸移动
  72. const onTouchMove = (event: any) => {
  73. const [{ pageY }] = event.touches
  74. const current = state.newListTop[state.currentItemIndex]
  75. const prep = state.newListTop[state.currentItemIndex - 1]
  76. const next = state.newListTop[state.currentItemIndex + 1]
  77. // 获取移动差值
  78. state.newListTop[state.currentItemIndex] = current + (pageY - state.touchY)
  79. // 记录手指坐标
  80. state.touchY = pageY
  81. // 向下移动(超过下一个的1/2就进行换位)
  82. if (next && current > next - ITEM_HEIGHT / 2) {
  83. changePosition(state.currentItemIndex + 1)
  84. } else if (prep && current < prep + ITEM_HEIGHT / 2) {
  85. // 向上移动(超过上一个的1/2就进行换位)
  86. changePosition(state.currentItemIndex - 1)
  87. }
  88. }
  89. // 触摸结束
  90. const onTouchEnd = () => {
  91. touchFinaly()
  92. }
  93. // 触摸异常关闭
  94. const onTouchCancel = () => {
  95. touchFinaly()
  96. }
  97. // 触摸最终执行
  98. const touchFinaly = () => {
  99. // 将拖拽的item归位
  100. state.newListTop[state.currentItemIndex] = state.initListTop[state.currentItemIndex]
  101. state.currentItemIndex = -1
  102. state.dragListContainerCanScroll = true
  103. }
  104. // 交换位置
  105. const changePosition = (index: number) => {
  106. // 记录当前拖拽的item数据
  107. const tempItem = state.dragList[state.currentItemIndex]
  108. const oneId: number = tempItem.id
  109. const twoId: number = state.dragList[index].id
  110. // 设置原来位置的item
  111. state.dragList[state.currentItemIndex] = state.dragList[index]
  112. // 将临时存放的数据设置好
  113. state.dragList[index] = tempItem
  114. emits('changeDragItemOrder', oneId, twoId)
  115. // 调整位置item
  116. state.newListTop[index] = state.newListTop[state.currentItemIndex]
  117. state.newListTop[state.currentItemIndex] = state.currentItemTop
  118. // 改变当前操作的的下标
  119. state.currentItemIndex = index
  120. // 记录新位置的数据
  121. state.currentItemTop = state.initListTop[state.currentItemIndex]
  122. uni.vibrateShort({
  123. type: 'heavy',
  124. })
  125. }
  126. // 删除拖拽明细
  127. const onDelDragItem = (index: number) => {
  128. const delItem: DragListItem = state.dragList[index]
  129. state.dragList.splice(index, 1)
  130. state.currentSelectedId = -1
  131. state.initListTop = getDragItemTop()
  132. state.newListTop = getDragItemTop()
  133. emits('delDragItem', delItem.id)
  134. }
  135. // 选择拖拽项
  136. const onSelectDragItem = (index: number) => {
  137. const selectedItem: DragListItem = state.dragList[index]
  138. state.currentSelectedId = selectedItem.id
  139. emits('selectDragItem', selectedItem.id)
  140. }
  141. // 添加拖拽项
  142. const addDragItem = (id: number, url: string) => {
  143. state.dragList.splice(0, 0, {
  144. id: id,
  145. url: url,
  146. })
  147. const top: number = (state.dragList.length - 1) * ITEM_HEIGHT
  148. state.initListTop = getDragItemTop()
  149. state.newListTop = getDragItemTop()
  150. state.currentSelectedId = id
  151. }
  152. // 删除拖拽项
  153. const delDragItem = (id: number) => {
  154. const index: number = state.dragList.findIndex((item) => item.id === id)
  155. state.dragList.splice(index, 1)
  156. state.initListTop = getDragItemTop()
  157. state.newListTop = getDragItemTop()
  158. }
  159. // 选择拖拽项
  160. const selectDragItem = (id: number) => {
  161. state.currentSelectedId = id
  162. }
  163. // 暴露函数
  164. defineExpose({
  165. addDragItem,
  166. delDragItem,
  167. selectDragItem,
  168. })
  169. </script>
  170. <template>
  171. <view class="list-drag-panel">
  172. <scroll-view
  173. class="drag-list-scroll"
  174. :scroll-y="state.dragListContainerCanScroll"
  175. :style="{ height: '100%' }"
  176. >
  177. <view
  178. class="drag-list-item"
  179. :class="{ selected: state.currentSelectedId === item.id }"
  180. v-for="(item, index) in state.dragList"
  181. :style="{
  182. top: state.newListTop[index] + 'px',
  183. }"
  184. :key="'drag-list-item_' + index"
  185. >
  186. <view class="drag-list-item-item drag-list-item-left" @tap="onDelDragItem(index)">
  187. <image class="remove-icon" lazy-load src="/static/images/del.png" mode="widthFix"></image>
  188. </view>
  189. <view class="drag-list-item-item drag-list-item-center" @tap="onSelectDragItem(index)">
  190. <image class="layer-img" lazy-load :src="item.url" mode="aspectFit" />
  191. <text>图层{{ index + 1 }}</text>
  192. </view>
  193. <view
  194. class="drag-list-item-item drag-list-item-right"
  195. @touchstart="onTouchStart($event, index)"
  196. @touchmove="onTouchMove"
  197. @touchend="onTouchEnd"
  198. @touchcancel="onTouchCancel"
  199. >
  200. <image class="drag-icon" lazy-load src="/static/images/drag.png" mode="widthFix"></image>
  201. </view>
  202. </view>
  203. </scroll-view>
  204. </view>
  205. </template>
  206. <style lang="scss" scoped>
  207. .list-drag-panel {
  208. height: 100%;
  209. .drag-list-scroll {
  210. height: 100%;
  211. width: 100%;
  212. overflow-y: auto;
  213. position: relative;
  214. .drag-list-item {
  215. display: flex;
  216. position: absolute;
  217. left: 0;
  218. right: 0;
  219. justify-content: space-between;
  220. align-items: center;
  221. padding-right: 5px;
  222. margin: 0px 5px;
  223. &.selected {
  224. background-color: #f0fff0;
  225. border-radius: 10px;
  226. }
  227. .drag-list-item-left {
  228. padding: 5px 10px;
  229. height: 45px;
  230. display: flex;
  231. justify-content: center;
  232. align-items: center;
  233. .remove-icon {
  234. width: 20px;
  235. height: 20px;
  236. padding-right: 5px;
  237. }
  238. }
  239. .drag-list-item-center {
  240. width: 100%;
  241. padding: 5px 0px;
  242. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  243. .layer-img {
  244. width: 40px;
  245. height: 40px;
  246. margin: 2px 15px 2px 0px;
  247. }
  248. }
  249. .drag-list-item-item:last-child {
  250. margin-left: auto;
  251. }
  252. .drag-list-item-right {
  253. padding: 0px 10px;
  254. height: 55px;
  255. display: flex;
  256. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  257. justify-content: center;
  258. align-items: center;
  259. .drag-icon {
  260. width: 20px;
  261. height: 20px;
  262. }
  263. }
  264. }
  265. }
  266. }
  267. </style>

 这里的问题点是 要动态控制”scroll-view“ 是否可滚动,在移动图层顺序时,是不允许滚动的。

十、导出与分享

将主canvas导出,这里的问题是,因为在选中和居中时,会有特殊线条,希望在导出时,重新绘制图层,可发现有时候重新绘制图层位置会偏移,未找到问题。

十一、未来发展和优化方向

当前这个小程序已上线,有兴趣的可以搜索进去看看,有疑问的大家可以留言交流。

目前此小程序未实现 2d canvas,后续可以研究下2d

后续继续增加undo 效果。

比较鸡肋的是,不能直接将制作的表情加入微信聊天中(腾讯是真坑,自家小程序可以,未开放其他人)。

好了,大家有疑问的可以留言沟通哈。 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/1019819
推荐阅读
相关标签
  

闽ICP备14008679号