Подтвердить что ты не робот

Анимация формы текста, анимация формы снаружи

Я пытаюсь выполнить следующую анимацию в тексте абзаца:

абзац абзаца: изменение формы текста

Цель состоит в том, чтобы анимировать границы текста в соответствии с формой слева. Это то, что я пробовал, но не могу понять переход по форме текста:

.mainDiv {
  width: 600px;
  margin: 0px auto;
  border: solid 1px #000;
  padding: 10px;
  min-height: 200px;
}
.element {
  width: 200px;
  height: 200px;
  background: #e3f5f1;
  float: left;
  margin-right: 5px;
}
.textElement {
  width: 395px;
  float: left;
}
<div class="mainDiv">
  <div class="element"></div>
  <div class="textElement">
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus Page Maker including versions of Lorem Ipsum, and more recently with desktop publishing software.
  </div>
</div>
4b9b3361

Ответ 1

Отказ от ответственности: Свойство shape-outside не должно использоваться в живых проектах 1. Он может подвергаться нежелательному поведению.

Этот вид макета может быть достигнут с помощью анимирования shape-outside и clip-path. Оба свойства могут быть перенесены для создания анимации.

Недостатком является то, что обе имеют очень низкую поддержку браузера, и сегодня эта анимация будет работать только в браузерах webkit, так как Firefox и IE/Edge не поддерживают shape-outside свойство или свойство clip-path со значением polygon().

Вот пример (только для webkit):

.mainDiv{
  width:600px;
  margin:0px auto;
  border:solid 1px #000;
  padding:10px;
  min-height:200px;
}
.element{
  width:200px;
  height:200px;
  background:#e3f5f1;
  float:left;
  margin-right:5px;
  -webkit-shape-outside: polygon(0% 0%, 100% 0%, 100% 100%, 0 100%);
          shape-outside: polygon(0% 0%, 100% 0%, 100% 100%, 0 100%);
  -webkit-clip-path:polygon(0% 0%, 100% 0%, 100% 100%, 0 100%);
          clip-path:polygon(0% 0%, 100% 0%, 100% 100%, 0 100%);
  transition: clip-path 1s, shape-outside 1s;
  transition: -webkit-clip-path 1s, shape-outside 1s;
}
.element:hover{
  -webkit-shape-outside: polygon(0% 0%, 100% 50%, 100% 50%, 0 100%);
          shape-outside: polygon(0% 0%, 100% 50%, 100% 50%, 0 100%);
  -webkit-clip-path:polygon(0% 0%, 100% 50%, 100% 50%, 0 100%);
          clip-path:polygon(0% 0%, 100% 50%, 100% 50%, 0 100%);
  
}
<div class="mainDiv">
  <div class="element"></div>
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus Page Maker including versions of Lorem Ipsum, and more recently with desktop publishing software.
</div>

Ответ 2

CSS

Для этого вам нужно использовать некоторые новые и в основном неподдерживаемые элементы в вашем CSS для достижения желаемого эффекта.

Эти два элемента:

Обратите внимание, что это не работает в FF по запросу, но я считаю, что он не будет слишком далеко.

.mainDiv {
  width: 600px;
  margin: 0px auto;
  border: solid 1px #000;
  padding: 10px;
  min-height: 200px;
}
.element {
  width: 200px;
  height: 200px;
  background: #e3f5f1;
  float: left;
  margin-right: 5px;
  shape-outside: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transition: shape-outside 1s, clip-path 1s, -webkit-clip-path 1s;
}
.element:hover {
  shape-outside: polygon(0 0, 100% 50%, 100% 50%, 0 100%);
  -webkit-clip-path: polygon(0 0, 100% 50%, 100% 50%, 0 100%);
  clip-path: polygon(0 0, 100% 50%, 100% 50%, 0 100%);
}
<div class="mainDiv">
  <div class="element"></div>
  <div class="textElement">
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus Page Maker including versions of Lorem Ipsum, and more recently with desktop publishing software.
  </div>
</div>