利用HTML5实现3D魔方旋转拼图代码



25 98 33



特效描述:利用HTML5实现 3D魔方旋转 拼图代码,利用HTML5实现3D魔方旋转拼图代码

代码结构

1. 引入CSS

<link rel='stylesheet prefetch' href='https://fonts.googleapis.com/icon?family=Material+Icons'>
<link rel="stylesheet" href="css/style.css">

2. 引入JS

<script src='js/hammer.min.js'></script>
<script src='js/81d2a0d609b2dd7ade6aeb5d5be42e24.js'></script>
<script src="js/index.js"></script>

3. HTML代码

<div class="body-wrapper">
<div class="cubetwo-help-component">
<div class="cubetwo-row">
  <div class="cubetwo-device-info">
	<i class="material-icons">touch_app</i>
	<div>tap or swipe with fingers</div>
  </div>
  <div class="cubetwo-device-info">
	<i class="material-icons">mouse</i>
	<div>click or swipe with mouse</div>
  </div>
  <div class="cubetwo-device-info cubetwo-device-info--keyboard">
	<i class="material-icons">keyboard</i>
	<div>keyboard keys</div>
	<div class="cubetwo-device-info-groups">
	  <div class="cubetwo-device-info-group">
		<div>
		  <i class="material-icons">keyboard_tab</i>
		  <i class="material-icons">keyboard_arrow_up</i>
		</div>
		<div>
		  <i class="material-icons">keyboard_arrow_left</i>
		  <i class="material-icons">keyboard_arrow_down</i>
		  <i class="material-icons">keyboard_arrow_right</i>
		</div>
	  </div>
	  <div class="cubetwo-device-info-group">
		<div>
		  <span>q</span>
		  <span>w</span>
		  <span>e</span>
		</div>
		<div>
		  <span>a</span>
		  <span>s</span>
		  <span>d</span>
		</div>
		<div>
		  <span>x</span>
		  <span>y</span>
		  <span>z</span>
		</div>
	  </div>
	</div>
  </div>
</div>
<a href="https://github.com/kunukn/cube-two" target="_blank" class="cubetwo-github-link">github project</a>
</div>
<div class="cubetwo-menu-component">
<div class="cubetwo-row">
  <button class="cubetwo-js cubetwo-btn cubetwo-btn-scramble">scramble</button>
  <button class="cubetwo-js cubetwo-btn cubetwo-btn-spin">spin</button>
  <button class="cubetwo-js cubetwo-btn cubetwo-btn-solve">solve</button>
</div>
</div>
<div class="cubetwo-component" id="cubetwo-component-1">
<div class="cubetwo-rotation-view">
  <div class="cubetwo-cube-group cubetwo-cube-group--1">
	<div class="cubetwo-cube-1" tabindex="0" data-type="cubetwo">
	  <div class="cubetwo-cube" data-type="cubetwo-display" data-index="1">
		<div data-type="front">
		  <div>front</div>
		</div>
		<div data-type="up">
		  <div>up</div>
		</div>
		<div data-type="right">
		  <div>right</div>
		</div>
		<div data-type="back">
		  <div>back</div>
		</div>
		<div data-type="down">
		  <div>down</div>
		</div>
		<div data-type="left">
		  <div>left</div>
		</div>
	  </div>
	  <div class="cubetwo-cube" data-type="cubetwo-touch">
		<div data-type="front">touch front</div>
		<div data-type="up">touch up</div>
		<div data-type="left">touch left</div>
	  </div>
	</div>
	<div class="cubetwo-cube-2" tabindex="0" data-type="cubetwo">
	  <div class="cubetwo-cube" data-type="cubetwo-display" data-index="2">
		<div data-type="front">
		  <div>front</div>
		</div>
		<div data-type="up">
		  <div>up</div>
		</div>
		<div data-type="right">
		  <div>right</div>
		</div>
		<div data-type="back">
		  <div>back</div>
		</div>
		<div data-type="down">
		  <div>down</div>
		</div>
		<div data-type="left">
		  <div>left</div>
		</div>
	  </div>
	  <div class="cubetwo-cube" data-type="cubetwo-touch">
		<div data-type="front">touch front</div>
		<div data-type="up">touch up</div>
		<div data-type="right">touch right</div>
	  </div>
	</div>
	<div class="cubetwo-cube-3" tabindex="0" data-type="cubetwo">
	  <div class="cubetwo-cube" data-type="cubetwo-display" data-index="3">
		<div data-type="front">
		  <div>front</div>
		</div>
		<div data-type="up">
		  <div>up</div>
		</div>
		<div data-type="right">
		  <div>right</div>
		</div>
		<div data-type="back">
		  <div>back</div>
		</div>
		<div data-type="down">
		  <div>down</div>
		</div>
		<div data-type="left">
		  <div>left</div>
		</div>
	  </div>
	  <div class="cubetwo-cube" data-type="cubetwo-touch">
		<div data-type="front">touch front</div>
		<div data-type="left">touch left</div>
		<div data-type="down">touch down</div>
	  </div>
	</div>
	<div class="cubetwo-cube-4" tabindex="0" data-type="cubetwo">
	  <div class="cubetwo-cube" data-type="cubetwo-display" data-index="4">
		<div data-type="front">
		  <div>front</div>
		</div>
		<div data-type="up">
		  <div>up</div>
		</div>
		<div data-type="right">
		  <div>right</div>
		</div>
		<div data-type="back">
		  <div>back</div>
		</div>
		<div data-type="down">
		  <div>down</div>
		</div>
		<div data-type="left">
		  <div>left</div>
		</div>
	  </div>
	  <div class="cubetwo-cube" data-type="cubetwo-touch">
		<div data-type="front">touch front</div>
		<div data-type="right">touch right</div>
		<div data-type="down">touch down</div>
	  </div>
	</div>
  </div>
  <div class="cubetwo-cube-group cubetwo-cube-group--2">
	<div class="cubetwo-cube-5" tabindex="0" data-type="cubetwo">
	  <div class="cubetwo-cube" data-type="cubetwo-display" data-index="5">
		<div data-type="front">
		  <div>front</div>
		</div>
		<div data-type="up">
		  <div>up</div>
		</div>
		<div data-type="right">
		  <div>right</div>
		</div>
		<div data-type="back">
		  <div>back</div>
		</div>
		<div data-type="down">
		  <div>down</div>
		</div>
		<div data-type="left">
		  <div>left</div>
		</div>
	  </div>
	  <div class="cubetwo-cube" data-type="cubetwo-touch">
		<div data-type="up">touch up</div>
		<div data-type="left">touch left</div>
		<div data-type="back">touch back</div>
	  </div>
	</div>
	<div class="cubetwo-cube-6" tabindex="0" data-type="cubetwo">
	  <div class="cubetwo-cube" data-type="cubetwo-display" data-index="6">
		<div data-type="front">
		  <div>front</div>
		</div>
		<div data-type="up">
		  <div>up</div>
		</div>
		<div data-type="right">
		  <div>right</div>
		</div>
		<div data-type="back">
		  <div>back</div>
		</div>
		<div data-type="down">
		  <div>down</div>
		</div>
		<div data-type="left">
		  <div>left</div>
		</div>
	  </div>
	  <div class="cubetwo-cube" data-type="cubetwo-touch">
		<div data-type="up">touch up</div>
		<div data-type="right">touch right</div>
		<div data-type="back">touch back</div>
	  </div>
	</div>
	<div class="cubetwo-cube-7" tabindex="0" data-type="cubetwo">
	  <div class="cubetwo-cube" data-type="cubetwo-display" data-index="7">
		<div data-type="front">
		  <div>front</div>
		</div>
		<div data-type="up">
		  <div>up</div>
		</div>
		<div data-type="right">
		  <div>right</div>
		</div>
		<div data-type="back">
		  <div>back</div>
		</div>
		<div data-type="down">
		  <div>down</div>
		</div>
		<div data-type="left">
		  <div>left</div>
		</div>
	  </div>
	  <div class="cubetwo-cube" data-type="cubetwo-touch">
		<div data-type="left">touch left</div>
		<div data-type="back">touch back</div>
		<div data-type="down">touch down</div>
	  </div>
	</div>
	<div class="cubetwo-cube-8" tabindex="0" data-type="cubetwo">
	  <div class="cubetwo-cube" data-type="cubetwo-display" data-index="8">
		<div data-type="front">
		  <div>front</div>
		</div>
		<div data-type="up">
		  <div>up</div>
		</div>
		<div data-type="right">
		  <div>right</div>
		</div>
		<div data-type="back">
		  <div>back</div>
		</div>
		<div data-type="down">
		  <div>down</div>
		</div>
		<div data-type="left">
		  <div>left</div>
		</div>
	  </div>
	  <div class="cubetwo-cube" data-type="cubetwo-touch">
		<div data-type="right">touch right</div>
		<div data-type="back">touch back</div>
		<div data-type="down">touch down</div>
	  </div>
	</div>
  </div>
</div>
<div class="cubetwo-button-grid cubetwo-row-top">
  <button class="cubetwo-js cubetwo-btn-top-left cubetwo-btn-adjust"><i class="material-icons" aria-hidden="true">adjust</i></button>
  <button class="cubetwo-js cubetwo-btn-top-center" aria-label="rotate up"><i class="material-icons" aria-hidden="true">&#xE5D8;</i></button>
  <button class="cubetwo-js cubetwo-btn-top-right cubetwo-btn-adjust"><i class="material-icons" aria-hidden="true">adjust</i></button>
</div>
<div class="cubetwo-button-grid cubetwo-column-left">
  <div></div>
  <div>
	<button class="cubetwo-js cubetwo-btn-rotate-left-2x" aria-label="rotate left 2"><i class="material-icons" aria-hidden="true">rotate_left</i></button>
	<button class="cubetwo-js cubetwo-btn-rotate-left" aria-label="rotate left"><i class="material-icons" aria-hidden="true">&#xE5C4;</i></button>
	<button class="cubetwo-js cubetwo-btn-toggle cubetwo-btn-help"><i class="material-icons">help_outline</i></button>
  </div>
  <div></div>
</div>
<div class="cubetwo-button-grid cubetwo-column-right">
  <div></div>
  <div>
	<button class="cubetwo-js cubetwo-btn-rotate-right-2x" aria-label="rotate right 2"><i class="material-icons" aria-hidden="true">rotate_right</i></button>
	<button class="cubetwo-js cubetwo-btn-rotate-right" aria-label="rotate right"><i class="material-icons" aria-hidden="true">arrow_forward</i></button>
	<button class="cubetwo-js cubetwo-btn-toggle cubetwo-btn-menu" aria-label="menu"><i class="material-icons" aria-hidden="true">menu</i></button>
  </div>
  <div></div>
</div>
<div class="cubetwo-button-grid cubetwo-row-bottom">
  <button class="cubetwo-js cubetwo-btn-bottom-left cubetwo-btn-adjust"><i class="material-icons" aria-hidden="true">adjust</i></button>
  <button class="cubetwo-js cubetwo-btn-bottom-center" aria-label="rotate down"><i class="material-icons" aria-hidden="true">&#xE5DB;</i></button>
  <button class="cubetwo-js cubetwo-btn-bottom-right cubetwo-btn-adjust"><i class="material-icons" aria-hidden="true">adjust</i></button>
</div>
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 旋转翻转 旋转 翻转 切换按钮 表单 表单美化 表单插件 表单美化插件 小游戏 H5游戏 游戏源码 手机游戏 微信游戏 网页游戏 图片翻转 图片旋转 其他游戏 其他h5游戏 其他h5源码游戏 按钮控制

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到